package top.wuyang.trywork.controller;


import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import top.wuyang.trywork.base.PageBean;
import top.wuyang.trywork.base.R;
import top.wuyang.trywork.entity.TbGamePublisher;
import top.wuyang.trywork.service.TbGamePublisherService;
import top.wuyang.trywork.vo.PageVO;

@RestController
@RequestMapping("/gamePublisher")
@RequiredArgsConstructor
public class TbGamePublisherController {

    private final TbGamePublisherService tbGamePublisherService;

    @GetMapping("/{pn}/{ps}")
    public R<PageVO<TbGamePublisher>> query(@PathVariable("pn") Long pageNumber, @PathVariable("ps") Long pageSize, TbGamePublisher tbGamePublisher) {
        return tbGamePublisherService.queryPage(PageBean.instance(pageNumber, pageSize), tbGamePublisher);
    }

    @GetMapping("/{id}")
    public R<TbGamePublisher> queryById(@PathVariable("id") Integer id){
        return tbGamePublisherService.queryById(id);
    }

    @PostMapping("")
    public R<String> insert(@RequestBody TbGamePublisher tbGamePublisher){
        return tbGamePublisherService.insert(tbGamePublisher);
    }

    @PutMapping("")
    public R<String> update(@RequestBody TbGamePublisher tbGamePublisher){
        return tbGamePublisherService.update(tbGamePublisher);
    }

    @DeleteMapping("/{id}")
    public R<String> delete(@PathVariable("id") Integer id){
        return tbGamePublisherService.delete(id);
    }









}
